home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / Prograph Classic 2.6.1 / Prograph Reference Manual / Prograph Reference 5-7 / Prograph Reference 5-7.rsrc / TEXT_167.txt < prev    next >
Encoding:
Text File  |  1995-10-25  |  12.5 KB  |  600 lines

  1.  
  2. Math
  3.  
  4. Prograph math primitives use the Apple SANE library of mathematical routines. The integer arithmetic primitives all have names created by doubling the names of the corresponding primitives:  **, ++, --, and √∑√∑. They boost performance and therefore should be used instead of their real arithmetic counterparts where possible (for example, when calculating coordinates for graphics).
  5.  
  6.  
  7. _________________________________________________
  8.  
  9.                                             *     *300*
  10.  
  11.  
  12. Input names: Number1; Number2; [Number3;  ...]
  13.  
  14. Input types: <number>; <number>; [<number>;  ...]
  15.  
  16. Output names: Product
  17.  
  18. Output types: <number>
  19.  
  20. Description:     Product is the product of Number1, Number2, ‚Ķ .
  21.  
  22. See also:  +, -, √∑, ++, --, **, √∑√∑, +1, -1
  23.  
  24.  
  25. _________________________________________________
  26.  
  27.                                            **     *300*
  28.  
  29.  
  30. Input names: Integer1; Integer2; [Integer3;  ...]
  31.  
  32. Input types: integer;  integer; [integer;  ...]
  33.  
  34. Output names: Product
  35.  
  36. Output types: integer
  37.  
  38. Description:     Product is the product of Integer1, Integer2, ‚Ķ.
  39.  
  40. See also:  +, -, *, √∑, ++, --, √∑√∑, +1, -1
  41.  
  42.  
  43. _________________________________________________
  44.  
  45.                                         +     *301*
  46.  
  47.  
  48. Input names: Number1; Number2; [Number3;  ...]
  49.  
  50. Input types: <number>; <number>; [<number>;  ...]
  51.  
  52. Output names: Sum
  53.  
  54. Output types: <number>
  55.  
  56. Description:     Sum is the sum of Number1, Number2, ‚Ķ.
  57.  
  58. See also:   -, *, √∑, ++, --, **, √∑√∑, +1, -1
  59.  
  60.  
  61. _________________________________________________
  62.  
  63.                                          ++     *301*
  64.  
  65.  
  66. Input names: Integer1; Integer2; [Integer3;  ...]
  67.  
  68. Input types: integer; integer; [integer;  ...]
  69.  
  70. Output names: Sum
  71.  
  72. Output types: integer
  73.  
  74. Description:     Sum is the sum of Integer1, Integer2, ‚Ķ.
  75.  
  76. See also:  +, -, *, √∑, --, **, √∑√∑, +1, -1
  77.  
  78.  
  79. _________________________________________________
  80.  
  81.                            +1     *301*
  82.  
  83.  
  84. Input types: <number>
  85.  
  86. Output types: <number>
  87.  
  88. Description:     Result is Number+1.
  89.  
  90. See also:  +, -, *, √∑, ++, --, **, √∑√∑, -1
  91.  
  92.  
  93. _________________________________________________
  94.  
  95.                                           -     *302*
  96.  
  97.  
  98. Input names: [Number1]; Number2
  99.  
  100. Input types: [<number>]; <number>
  101.  
  102. Output names: Result
  103.  
  104. Output types: <number>
  105.  
  106. Description:     Result is Number1 - Number2.
  107.  
  108. See also:   +, *, √∑, ++, --, **, √∑√∑, +1, -1
  109.  
  110.  
  111. _________________________________________________
  112.  
  113.                                          - -     *302*
  114.  
  115.  
  116. Input names: [Integer1]; Integer2
  117.  
  118. Input types: [integer]; integer
  119.  
  120. Output names: Result
  121.  
  122. Output types: integer
  123.  
  124. Description:     Result is Integer1 - Integer2.
  125.  
  126. See also:  +, -, *, √∑, ++, **, √∑√∑, +1, -1
  127.  
  128.  
  129. _________________________________________________
  130.  
  131.                       -1     *302*
  132.  
  133.  
  134. Input types: <number>
  135.  
  136. Output types: <number>
  137.  
  138. Description:     Result is Number - 1.
  139.  
  140. See also:  +, -, *, √∑, ++, --, **, √∑√∑, +1
  141.  
  142.  
  143. _________________________________________________
  144.  
  145.                     abs     *303*
  146.  
  147.  
  148. Input types: <number>
  149.  
  150. Output types: <number>
  151.  
  152. Description:     Result is the absolute value of Number.
  153.  
  154. See also:  sign, sign-extend
  155.  
  156.  
  157. _________________________________________________
  158.  
  159.                       acos     *303*
  160.  
  161.  
  162. Input types: <number>
  163.  
  164. Output types: <number>
  165.  
  166. Description:     Angle is arccosine(Cosine) expressed in radians.
  167.  
  168. See also:  sin, cos, tan, asin, atan, atan2
  169.  
  170.  
  171. _________________________________________________
  172.  
  173.                           annuity      *303*
  174.  
  175.  
  176. Input types: <number>;    <number>
  177.  
  178. Output types: <number>
  179.  
  180. Description:     Annuity is (1 - (1 + R)^-N) / R, where R is the interest rate and N is the number of periods.
  181.  
  182. See also:  compound
  183.  
  184.  
  185. _________________________________________________
  186.  
  187.                         asin    *304*
  188.  
  189.  
  190. Input types: <number>
  191.  
  192. Output types: <number>
  193.  
  194. Description:     Angle is arcsine(Sine) expressed in radians.
  195.  
  196. See also:  sin, cos, tan, acos, atan, atan2
  197.  
  198.  
  199. _________________________________________________
  200.  
  201.                        atan     *304*
  202.  
  203.  
  204. Input types: <number>
  205.  
  206. Output types: <number>
  207.  
  208. Description:     Angle is arctangent(Tangent) expressed in radians.
  209.  
  210. See also:  sin, cos, tan, asin, acos, atan2
  211.  
  212.  
  213. _________________________________________________
  214.  
  215.                         atan2     *304*
  216.  
  217.  
  218. Input types: <number>; <number>
  219.  
  220. Output types: <number>
  221.  
  222. Description:     Angle is arctangent(Y√∑X) expressed in radians.
  223.  
  224. See also:  sin, cos, tan, asin, acos, atan
  225.  
  226.  
  227. _________________________________________________
  228.  
  229.                                 compound      *305*
  230.  
  231.  
  232. Input types: <number>; <number>
  233.  
  234. Output types: <number>
  235.  
  236. Description:     Compound is (1 + R )^N where R is the interest rate and N is the number of periods.
  237.  
  238. See also:     annuity
  239.  
  240.  
  241. _________________________________________________
  242.  
  243.                         cos     *305*
  244.  
  245.  
  246. Input types: <number>
  247.  
  248. Output types: <number>
  249.  
  250. Description:     Cosine is cosine(Angle).
  251.  
  252. See also:   sin, tan, asin, acos, atan, atan2
  253.  
  254.  
  255. _________________________________________________
  256.  
  257.                                  div     *305*
  258.  
  259.  
  260. Input names: [Dividend];  Divisor
  261.  
  262. Input types: [<number>];    <number>
  263.  
  264. Defaults: Dividend = 1
  265.  
  266. Output names: Quotient
  267.  
  268. Output types: <number>
  269.  
  270. Description:     Quotient is the quotient of Dividend by Divisor. With only one input, Quotient is reciprocal of Divisor.
  271.  
  272. Alias: √∑
  273.  
  274. See also:  +, -, *, ++, --, **, √∑√∑, idiv, +1, -1
  275.  
  276.  
  277. _________________________________________________
  278.  
  279.                    exp     *306*
  280.  
  281.  
  282. Input types: <number>
  283.  
  284. Output types: <number>
  285.  
  286. Description:     Result is e (1.718281...) to the power of Exponent.
  287.  
  288. See also:  ln, log10, power, sqrt
  289.  
  290.  
  291. _________________________________________________
  292.  
  293.                                    idiv     *306*
  294.  
  295.  
  296. Input names: [Dividend];  Divisor
  297.  
  298. Input types: [integer];  integer
  299.  
  300. Defaults: Dividend = 1
  301.  
  302. Output names: Quotient;  [Remainder]
  303.  
  304. Output types: integer;  [integer]
  305.  
  306. Description:     Quotient and Remainder are the quotient and remainder of the integer division of Dividend by Divisor.
  307.  
  308. Alias: √∑√∑
  309.  
  310. See also:  +, -, *, √∑, div, ++, --, **, +1, -1
  311.  
  312.  
  313. _________________________________________________
  314.  
  315.                     ln     *306*
  316.  
  317.  
  318. Input types: <number>
  319.  
  320. Output types: <number>
  321.  
  322. Description:     Log is the natural logarithm (base e) of Number.
  323.  
  324. See also:  exp, log10, power, sqrt
  325.  
  326.  
  327. _________________________________________________
  328.  
  329.                         log10     *307*
  330.  
  331.  
  332. Input types: <number>
  333.  
  334. Output types: <number>
  335.  
  336. Description:     Log is the logarithm (base 10) of Number.
  337.  
  338. See also:  exp, ln, power, sqrt
  339.  
  340.  
  341. _________________________________________________
  342.  
  343.                                         max     *307*
  344.  
  345.  
  346. Input names: Number1;    [Number2;  ...]
  347.  
  348. Input types: <number>;    [<number>;  ...]
  349.  
  350. Output names: Max
  351.  
  352. Output types: <number>
  353.  
  354. Description:     Max is the maximum of Number1,  ....
  355.  
  356. See also:  min
  357.  
  358.  
  359. _________________________________________________
  360.  
  361.                                      min     *307*
  362.  
  363.  
  364. Input names: Number1;    [Number2;  ...]
  365.  
  366. Input types: <number>;    [<number>;  ...]
  367.  
  368. Output names: Min
  369.  
  370. Output types: <number>
  371.  
  372. Description:     Min is the minimum of Number1,  ....
  373.  
  374. See also:     max
  375.  
  376.  
  377. _________________________________________________
  378.  
  379.                 pi     *308*
  380.  
  381.  
  382. Output types: real
  383.  
  384. Description:     Pi is the value of pi (3.1415926...).
  385.  
  386.  
  387. _________________________________________________
  388.  
  389.                                       power     *308*
  390.  
  391.  
  392. Input types: <number>;    <number>
  393.  
  394. Output types: <number>
  395.  
  396. Description:     Result is Number to the power of Exponent. If Number and Exponent are both 0, Result is 1.
  397.  
  398. See also:  exp, ln, log10, sqrt
  399.  
  400.  
  401. _________________________________________________
  402.  
  403.                       rand     *308*
  404.  
  405.  
  406. Output types: integer
  407.  
  408. Description:     Returns a random integer between and including 1 and (2**31) - 2.
  409.  
  410. See also:  set-seed
  411.  
  412.  
  413. _________________________________________________
  414.  
  415.                         round     *308*
  416.  
  417.  
  418.  
  419. Input types: <number>;  [thePrecision]
  420.  
  421. Output types: <number>
  422.  
  423. Description:     Result is the number closest to Number, according to thePrecision. Positive and negative values for thePrecision indicate the number of decimal places to the right and left of the decimal point, respectively. If thePrecision is not given, or is 0, Result is the integer closest to Number. 
  424.  
  425. Note:     If two values are equally near to Number, Round uses the Apple SANE library convention of rounding to the even value. For instance, 12.5 rounds to 12, and 13.5 rounds to 14.
  426.  
  427.  Rounding to a given number of decimal places does not necessarily mean that the floating point representation of that number has that number of decimal places:  it may have more. The number .95, for example, is actually .9499999999999999999. Use the format primitive to store such numbers as strings with the desired number of decimal places.
  428.  
  429. See also:     trunc
  430.  
  431.  
  432. _________________________________________________
  433.  
  434.                                      round-down    *309*
  435.  
  436.  
  437.  
  438. Input types: <number>;  [thePrecision]
  439.  
  440. Output types: <number>
  441.  
  442. Description:     Result is the nearest number less than (or equal to) Number, according to thePrecision. Positive and negative values for thePrecision indicate the number of decimal places to the right and left of the decimal point, respectively. If thePrecision is not given, or is 0, Result is the nearest integer less than (or equal to) Number. 
  443.  
  444. See also:     round, round-up, trunc
  445.  
  446.  
  447. _________________________________________________
  448.  
  449.                                round-up     *309*
  450.  
  451.  
  452.  
  453. Input types: <number>;  [thePrecision]
  454.  
  455. Output types: <number>
  456.  
  457. Description:     Result is the nearest number greater than or equal to Number, according to thePrecision. Positive and negative values for thePrecision indicate the number of decimal places to the right and left of the decimal point, respectively. If thePrecision is not given, or is 0, Result is the nearest integer greater than (or equal to) Number. 
  458.  
  459. See also:     round, round-down, trunc
  460.  
  461.  
  462. _________________________________________________
  463.  
  464.                               set-seed     *310*
  465.  
  466.  
  467. Input types: <number>
  468.  
  469. Description:     The seed for the random-number generator is set to the integral part of Seed (0 to (2**31) - 1).
  470.  
  471. See also:  rand
  472.  
  473.  
  474. _________________________________________________
  475.  
  476.                          sign     *310*
  477.  
  478.  
  479. Input types: <number>
  480.  
  481. Output types: integer
  482.  
  483. Description:     Sign is 1 if Number is positive, 0 if Number is 0, and -1 otherwise.
  484.  
  485. See also:  abs, sign-extend
  486.  
  487.  
  488. _________________________________________________
  489.  
  490.                                         sign-extend     *310*
  491.  
  492.  
  493. Input types: integer; integer
  494.  
  495. Output types: integer
  496.  
  497. Description:     If Offset is 1, ValueOut is the integer obtained by propagating the leftmost bit of the rightmost byte of ValueIn through the three left bytes. If Offset is 2, ValueOut is the integer obtained by propagating the leftmost bit of the second least significant byte of ValueIn through the two left bytes.
  498.  
  499. See also:  abs, sign, get-integer
  500.  
  501.  
  502. _________________________________________________
  503.  
  504.                    sin     *311*
  505.  
  506.  
  507. Input types: <number>
  508.  
  509. Output types: <number>
  510.  
  511. Description:     Sine is sine(Angle).
  512.  
  513. See also:  cos, tan, asin, acos, atan, atan2
  514.  
  515.  
  516. _________________________________________________
  517.  
  518.                      sqrt     *311*
  519.  
  520.  
  521. Input types: <number>
  522.  
  523. Output types: <number>
  524.  
  525. Description:     Root is the square root of Number.
  526.  
  527. See also:  exp, ln, log10, power
  528.  
  529.  
  530. _________________________________________________
  531.  
  532.                       tan     *311*
  533.  
  534.  
  535. Input types: <number>
  536.  
  537. Output types: <number>
  538.  
  539. Description:     Tangent is tangent(Angle).
  540.  
  541. See also:  sin, cos, asin, acos, atan, atan2
  542.  
  543.  
  544. _________________________________________________
  545.  
  546.                                      trunc     *311*
  547.  
  548.  
  549. Input types: <number>
  550.  
  551. Output types: integer | aNumber;  real
  552.  
  553. Description:     anInteger and Fraction are the integral and fractional part of Number respectively. The integral part is aNumber if Number is very large.
  554.  
  555. See also:  round
  556.  
  557.  
  558. _________________________________________________
  559.  
  560.                                       √∑     *312*
  561.  
  562.  
  563. Input names: [Dividend];  Divisor
  564.  
  565. Input types: [<number>];    <number>
  566.  
  567. Defaults: Dividend = 1
  568.  
  569. Output names: Quotient
  570.  
  571. Output types: <number>
  572.  
  573. Description:     Quotient is the quotient of Dividend by Divisor. With only one input, Quotient is reciprocal of Divisor.
  574.  
  575. Alias: div
  576.  
  577. See also:  +, -, *, ++, --, **, √∑√∑, idiv, +1, -1
  578.  
  579.  
  580. _________________________________________________
  581.  
  582.                                         √∑√∑     *312*
  583.  
  584.  
  585. Input names: [Dividend];  Divisor
  586.  
  587. Input types: [integer];  integer
  588.  
  589. Defaults: Dividend = 1
  590.  
  591. Output names: Quotient;  [Remainder]
  592.  
  593. Output types: integer;  [integer]
  594.  
  595. Description:     Quotient and Remainder are the quotient and remainder of the integer division of Dividend by Divisor.
  596.  
  597. Alias: idiv
  598.  
  599. See also:  +, -, *, √∑, div, ++, --, **, +1, -1
  600.